package stdio.costa.imoca.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@NamedQueries({
		@NamedQuery(name = "findPostcardBacksByActivity", query = "from PostcardBack pb where pb.activity =:activity"),
		@NamedQuery(name = "findPostcardBacksByTags", query = "from PostcardBack pb where pb.tags in (:tags)") })
public class PostcardBack extends UuidEntity {

	@Column(name = "url")
	private String url;

	@Column(name = "name")
	private String name;

	@Column(name = "description")
	private String description;

	@Column(name = "tags")
	private String tags;

	@XmlTransient
	@ManyToOne
	@JoinColumn(name = "activity_uuid")
	private Activity activity;

	public PostcardBack(String name, String description, String tags,
			Activity activity) {
		super();
		this.name = name;
		this.description = description;
		this.tags = tags;
		this.activity = activity;
	}

	public PostcardBack() {

	}

	public String getUrl() {
		return url;
	}

	public Activity getActivity() {
		return activity;
	}

	public void setActivity(Activity activity) {
		this.activity = activity;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getTags() {
		return tags;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}
}